//
//  BenefitPresentCell.m
//  LiveStar
//
//  Created by 漪珊 on 2017/4/19.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "BenefitPresentCell.h"
#import "BenefitModel.h"

@implementation BenefitPresentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.getStateLabel.text = @"";
    kViewRadius(self.backView, 5);
    kViewRadius(self.isReadNotice, self.isReadNotice.width/2.0f);
    UIBezierPath * maskPath = [UIBezierPath bezierPathWithRoundedRect:self.getStateLabel.layer.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerBottomLeft cornerRadii:CGSizeMake(10.0f, 10.0f)];
    CAShapeLayer * maskLayer = [CAShapeLayer new];
    maskLayer.frame = self.getStateLabel.layer.bounds;
    maskLayer.path = maskPath.CGPath;
    self.getStateLabel.layer.mask = maskLayer;
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(Call:)];
    [self.phoneNum addGestureRecognizer:tap];
    
}

- (void)setBenefitModel:(BenefitModel *)benefitModel {
    _benefitModel = benefitModel;
    self.presentName.text = TC_PROTECT_STR(benefitModel.g_name);
    self.senderName.text = TC_PROTECT_STR(benefitModel.s_name);
    self.effectiveTimeLabel.text = [NSString stringWithFormat:@"有效日期:%@",TC_PROTECT_STR(benefitModel.g_validtime)];
    self.supplyLabel.text = [NSString stringWithFormat:@"领取商家:%@",TC_PROTECT_STR(benefitModel.g_sponsor)];
    self.sendTime.text = TC_PROTECT_STR(benefitModel.o_createtime);
    self.phoneNum.text = TC_PROTECT_STR(benefitModel.g_phone);
    self.MsgTime.text = TC_PROTECT_STR(benefitModel.o_createtime);
    self.ElectronicCodeLabel.text = KString(TC_PROTECT_STR(benefitModel.g_number));
    self.password.text = KString(TC_PROTECT_STR(benefitModel.g_password));
    if ([benefitModel.g_status intValue] == 30) { //
        self.getStateLabel.text = @"未领取";
    } else {
        self.getStateLabel.text = @"已领取";
    }
}

- (void)Call:(UITapGestureRecognizer *)tap {
    if (self.callAction) {
        self.callAction();
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
